#include <iostream>
using namespace std;
#include <numeric>
#include <vector>
#include <algorithm>

void print(int a)
{
    cout << a << endl;
}

class Myprint
{
public:
    void operator()(int a)
    {
        cout << a << endl;
    }
};

int main()
{
    vector<int> v, v2, inter;
    for (int i = 1; i <= 100; ++i)
    {
        v.push_back(i);
    }
    
random_shuffle(v.begin(),v.end());

sort(v.begin(),v.end());

    int total = accumulate(v.begin(), v.end(), 1);

    for (int i = -5; i < 10; ++i)
    {
        v2.push_back(i);
    }

    inter.resize(min(v.size(), v2.size()));

    vector<int>::iterator itEnd = set_intersection(v.begin(), v.end(), v2.begin(), v2.end(), inter.begin());



    for_each(inter.begin(), itEnd, Myprint());

    cout << total << endl;
}
